/*
 * @Description:
 * @Author: zhangxueyu026593
 * @Date: 2022-08-29 20:06:29
 * @LastEditTime: 2022-08-29 20:28:00
 * @LastEditors:
 */
export function isIE () {
  if (!!window.ActiveXObject || 'ActiveXObject' in window) {
    return true;
  } else {
    return false;
  }
}

export function BrowserInfo () {
  var res = {
    name: '',
    version: '',
  };
  var reg;
  var userAgent = self.navigator.userAgent;

  if (reg = /edge\/([\d\.]+)/i.exec(userAgent)) {
    res.name = "Edge";
    res.version = reg[1];
  }
  else if (reg = /edg\/([\d\.]+)/i.exec(userAgent)) {
    res.name = "Edge(Chromium)";
    res.version = reg[1];
  }
  else if (/msie/i.test(userAgent)) {
    res.name = "Internet Explorer";
    res.version = /msie ([\d\.]+)/i.exec(userAgent)[1];
  }
  else if (/Trident/i.test(userAgent)) {
    res.name = "Internet Explorer";
    res.version = /rv:([\d\.]+)/i.exec(userAgent)[1];
  }
  else if (/chrome/i.test(userAgent)) {
    res.name = "Chrome";
    res.version = /chrome\/([\d\.]+)/i.exec(userAgent)[1];
  }
  else if (/safari/i.test(userAgent)) {
    res.name = "Safari";
    res.version = /version\/([\d\.]+)/i.exec(userAgent)[1];
  }
  else if (/firefox/i.test(userAgent)) {
    res.name = "Firefox";
    res.version = /firefox\/([\d\.]+)/i.exec(userAgent)[1];
  }
  return res;
}